package cn.shengchao.examstar.me.course.ohs.remote;

import cn.shengchao.examstar.me.course.application.query.CourseWatchTimeQuery;
import cn.shengchao.examstar.rpc.me.api.CourseWatchTimeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 课程观看时长远程服务
 * 提供给其他模块调用的Dubbo服务
 */
@Service
@Slf4j
public class CourseWatchTimeRemoteService implements CourseWatchTimeService {

    @Autowired
    private CourseWatchTimeQuery courseWatchTimeQuery;

    /**
     * 获取指定用户在指定类目下的课程总观看时长（秒）
     *
     * @param userId 用户ID
     * @param specificationTypeId 类目ID
     * @return 总观看时长（秒）
     */
    @Override
    public Long getTotalWatchLengthBySpecificationType(Long userId, Long specificationTypeId) {
        log.info("远程调用获取课程观看时长: userId={}, specificationTypeId={}", userId, specificationTypeId);
        return courseWatchTimeQuery.getTotalWatchLengthBySpecificationType(userId, specificationTypeId);
    }
} 